import React, { FC } from 'react'
import { TableItemWrap } from './style'
import { ItemLabel } from './ItemLabel'
import { ItemAction } from './ItemAction'
import { useMccStore } from '@/pages/manager/store'
import { DcsModel } from '@/api/manager/dcs/interface'
import { tableDcsItemCheck } from '@/pages/manager/store.combine'

interface TableItemProps {
	rowData: DcsModel
	isOdd: boolean
}
export const TableItem: FC<TableItemProps> = ({ rowData, isOdd }) => {
	const handleClick = () => {
		const superMtNum = useMccStore.getState().mccInfo.superMtNum
		if (superMtNum === 1) {
			if (rowData.mcc.status.isInteractive) {
				tableDcsItemCheck(rowData)
			}
		} else {
			tableDcsItemCheck(rowData)
		}
	}
	return (
		<TableItemWrap isOdd={isOdd} onClick={handleClick}>
			<ItemLabel {...rowData} />
			<ItemAction {...rowData} />
		</TableItemWrap>
	)
}
